home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Programming / amigatalk / intuition / GadgetAttrs.st < prev    next >
Encoding:
Text File  |  2001-02-28  |  10.8 KB  |  257 lines

  1. " --------------------------------------------------------------------- "
  2. " GadgetAttrs Class is a Singleton class that allows the user to        "
  3. " reference Gadget Attributes without having to remember their actual   "
  4. " hexadecimal values.                                                   "
  5. " --------------------------------------------------------------------- "
  6.  
  7. Class GadgetAttributes :Dictionary ! uniqueInstance !
  8. [
  9.    privateNew ! newinstance !
  10.      newinstance <- super new.
  11.  
  12.      ^ newinstance
  13. |
  14.    new
  15.      ^ (self privateSetup)
  16. |
  17.    privateInitializeDictionary    "Too big for a block."
  18.  
  19.       self at: #GA_Left           put: 16r80030001.
  20.       self at: #GA_RelRight       put: 16r80030002.
  21.       self at: #GA_Top            put: 16r80030003.
  22.       self at: #GA_RelBottom      put: 16r80030004.
  23.       self at: #GA_Width          put: 16r80030005.
  24.       self at: #GA_RelWidth       put: 16r80030006.
  25.       self at: #GA_Height         put: 16r80030007.
  26.       self at: #GA_RelHeight      put: 16r80030008.
  27.       self at: #GA_Text           put: 16r80030009.
  28.       self at: #GA_Image          put: 16r8003000A.
  29.       self at: #GA_Border         put: 16r8003000B.
  30.       self at: #GA_SelectRender   put: 16r8003000C.
  31.       self at: #GA_Highlight      put: 16r8003000D.
  32.       self at: #GA_Disabled       put: 16r8003000E.
  33.       self at: #GA_GZZGadget      put: 16r8003000F.
  34.       self at: #GA_ID             put: 16r80030010.
  35.       self at: #GA_UserData       put: 16r80030011.
  36.       self at: #GA_SpecialInfo    put: 16r80030012.
  37.       self at: #GA_Selected       put: 16r80030013.
  38.       self at: #GA_EndGadget      put: 16r80030014.
  39.       self at: #GA_Immediate      put: 16r80030015.
  40.       self at: #GA_RelVerify      put: 16r80030016.
  41.       self at: #GA_FollowMouse    put: 16r80030017.
  42.       self at: #GA_RightBorder    put: 16r80030018.
  43.       self at: #GA_LeftBorder     put: 16r80030019.
  44.       self at: #GA_TopBorder      put: 16r8003001A.
  45.       self at: #GA_BottomBorder   put: 16r8003001B.
  46.       self at: #GA_ToggleSelect   put: 16r8003001C.
  47.       self at: #GA_SysGadget      put: 16r8003001D.
  48.       self at: #GA_SysGType       put: 16r8003001E.
  49.       self at: #GA_Previous       put: 16r8003001F.
  50.       self at: #GA_Next           put: 16r80030020.
  51.       self at: #GA_DrawInfo       put: 16r80030021.
  52.       self at: #GA_IntuiText      put: 16r80030022.
  53.       self at: #GA_LabelImage     put: 16r80030023.
  54.       self at: #GA_TabCycle       put: 16r80030024.
  55.       self at: #GA_GadgetHelp     put: 16r80030025.
  56.       self at: #GA_Bounds         put: 16r80030026.
  57.       self at: #GA_RelSpecial     put: 16r80030027.
  58.       self at: #GA_TextAttr       put: 16r80030028.
  59.       self at: #GA_ReadOnly       put: 16r80030029.
  60.       self at: #GA_Underscore     put: 16r8003002A.
  61.       self at: #GA_ActivateKey    put: 16r8003002B.
  62.       self at: #GA_BackFill       put: 16r8003002C.
  63.       self at: #GA_GadgetHelpText put: 16r8003002D.
  64.       self at: #GA_UserInput      put: 16r8003002E.
  65.  
  66.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  67.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  68.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  69.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  70.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  71.  
  72.       " String Gadget Attributes: "
  73.  
  74.       self at: #STRINGA_MaxChars       put: 16r80032001.
  75.       self at: #STRINGA_Buffer         put: 16r80032002.
  76.       self at: #STRINGA_UndoBuffer     put: 16r80032003.
  77.       self at: #STRINGA_WorkBuffer     put: 16r80032004.
  78.       self at: #STRINGA_BufferPos      put: 16r80032005.
  79.       self at: #STRINGA_DispPos        put: 16r80032006.
  80.       self at: #STRINGA_AltKeyMap      put: 16r80032007.
  81.       self at: #STRINGA_Font           put: 16r80032008.
  82.       self at: #STRINGA_Pens           put: 16r80032009.
  83.       self at: #STRINGA_ActivePens     put: 16r8003200A.
  84.       self at: #STRINGA_EditHook       put: 16r8003200B.
  85.       self at: #STRINGA_EditModes      put: 16r8003200C.
  86.       self at: #STRINGA_ReplaceMode    put: 16r8003200D.
  87.       self at: #STRINGA_FixedFieldMode put: 16r8003200E.
  88.       self at: #STRINGA_NoFilterMode   put: 16r8003200F.
  89.       self at: #STRINGA_Justification  put: 16r80032010.
  90.       self at: #STRINGA_LongVal        put: 16r80032011.
  91.       self at: #STRINGA_TextVal        put: 16r80032012.
  92.       self at: #STRINGA_ExitHelp       put: 16r80032013.
  93.  
  94.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  95.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  96.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  97.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  98.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  99.  
  100.       " Proportional Gadget Attributes: "
  101.  
  102.       self at: #PGA_Freedom       put: 16r80031001.
  103.       self at: #PGA_Borderless    put: 16r80031002.
  104.       self at: #PGA_HorizPot      put: 16r80031003.
  105.       self at: #PGA_HorizBody     put: 16r80031004.
  106.       self at: #PGA_VertPot       put: 16r80031005.
  107.       self at: #PGA_VertBody      put: 16r80031006.
  108.       self at: #PGA_Total         put: 16r80031007.
  109.       self at: #PGA_Visible       put: 16r80031008.
  110.       self at: #PGA_Top           put: 16r80031009.
  111.       self at: #PGA_NewLook       put: 16r8003100A.
  112. |
  113.    privateSetup
  114.      (uniqueInstance isNil)
  115.        ifTrue: [uniqueInstance <- self privateNew.
  116.                 self privateInitializeDictionary   
  117.                ].
  118.  
  119.      ^ self
  120. ]
  121.  
  122. " -------------------------------------------------------------------- "
  123. " GadToolsAttributes Class is a singleton class for the attribute tags "
  124. " associated with GadTools Gadgets & GadTools Menus.                   "
  125. ""
  126. " NOTE:  The keys are in Gadget Order, not numerical order in here.    "
  127. " -------------------------------------------------------------------- "
  128.  
  129. Class GadToolsAttributes :Dictionary ! uniqueInstance !
  130. [
  131.    privateNew ! newinstance !
  132.      newinstance <- super new.
  133.  
  134.      ^ newinstance
  135. |
  136.    new
  137.      ^ (self privateSetup)
  138. |
  139.    privateInitializeDictionary        "Too big for a Block."
  140.  
  141.      "GadTools attributes (1-3, 25-37 reserved):"
  142.  
  143.      "NewMenu Attributes:"
  144.      self at: #GTMN_TextAttr          put: 16r80080031.
  145.      self at: #GTMN_FrontPen          put: 16r80080032.
  146.                 
  147.      "GTMN_Menu is used internally only!"
  148.      self at: #GTMN_Menu              put: 16r8008003C.
  149.  
  150.      self at: #GTMN_FullMenu          put: 16r8008003E.
  151.      self at: #GTMN_SecondaryError    put: 16r8008003F.
  152.      self at: #GTMN_Checkmark         put: 16r80080041.
  153.      self at: #GTMN_AmigaKey          put: 16r80080042.
  154.      self at: #GTMN_NewLookMenus      put: 16r80080043.
  155.  
  156.      "General Gadget Attributes:" 
  157.      self at: #GT_VisualInfo          put: 16r80080034.
  158.      self at: #GT_Reserved1           put: 16r80080038.
  159.      self at: #GT_Underscore          put: 16r80080040.
  160.  
  161.      "String (R/W) Gadget Attributes:"
  162.      self at: #GTST_String            put: 16r8008002D.
  163.      self at: #GTST_MaxChars          put: 16r8008002E.
  164.      self at: #GTST_EditHook          put: 16r80080037.
  165.  
  166.      "Integer (R/W) Gadget Attributes:"
  167.      self at: #GTIN_Number            put: 16r8008002F.
  168.      self at: #GTIN_MaxChars          put: 16r80080030.
  169.      self at: #GTIN_EditHook          put: 16r80080037.
  170.  
  171.      "Text (read-only) Gadget Attributes:"
  172.      self at: #GTTX_Text              put: 16r8008000B.
  173.      self at: #GTTX_CopyText          put: 16r8008000C.
  174.      self at: #GTTX_Border            put: 16r80080039.
  175.      self at: #GTTX_FrontPen          put: 16r80080048.
  176.      self at: #GTTX_BackPen           put: 16r80080049.
  177.      self at: #GTTX_Justification     put: 16r8008004A.
  178.      self at: #GTTX_Clipped           put: 16r80080055.
  179.  
  180.      "Number (read-only) Gadget Attributes:"
  181.      self at: #GTNM_Number            put: 16r8008000D.
  182.      self at: #GTNM_Border            put: 16r8008003A.
  183.      self at: #GTNM_FrontPen          put: 16r80080048.
  184.      self at: #GTNM_BackPen           put: 16r80080049.
  185.      self at: #GTNM_Justification     put: 16r8008004A.
  186.      self at: #GTNM_Format            put: 16r8008004B.
  187.      self at: #GTNM_MaxNumberLen      put: 16r8008004C.
  188.      self at: #GTNM_Clipped           put: 16r80080055.
  189.  
  190.      "ListView Gadget Attributes:"
  191.      self at: #GTLV_Top               put: 16r80080005.
  192.      self at: #GTLV_Labels            put: 16r80080006.
  193.      self at: #GTLV_ReadOnly          put: 16r80080007.
  194.      self at: #GTLV_ScrollWidth       put: 16r80080008.
  195.      self at: #GTLV_ShowSelected      put: 16r80080035.
  196.      self at: #GTLV_Selected          put: 16r80080036.
  197.      self at: #GTLV_MakeVisible       put: 16r8008004E.
  198.      self at: #GTLV_ItemHeight        put: 16r8008004F.
  199.      self at: #GTLV_CallBack          put: 16r80080053.
  200.      self at: #GTLV_MaxPen            put: 16r80080054.
  201.  
  202.      "CheckBox Gadget Attributes:"
  203.      self at: #GTCB_Checked           put: 16r80080004.
  204.      self at: #GTCB_Scaled            put: 16r80080044.
  205.  
  206.      "Radio Button (Mutual Excluded) Gadget Attributes:"
  207.      self at: #GTMX_Labels            put: 16r80080009.
  208.      self at: #GTMX_Active            put: 16r8008000A.
  209.      self at: #GTMX_Spacing           put: 16r8008003D.
  210.      self at: #GTMX_Scaled            put: 16r80080045.
  211.      self at: #GTMX_TitlePlace        put: 16r80080047.
  212.  
  213.      "Cycle Gadget Attributes:"
  214.      self at: #GTCY_Labels            put: 16r8008000E.
  215.      self at: #GTCY_Active            put: 16r8008000F.
  216.  
  217.      "Palette Gadget Attributes:"
  218.      self at: #GTPA_Depth             put: 16r80080010.
  219.      self at: #GTPA_Color             put: 16r80080011.
  220.      self at: #GTPA_ColorOffset       put: 16r80080012.
  221.      self at: #GTPA_IndicatorWidth    put: 16r80080013.
  222.      self at: #GTPA_IndicatorHeight   put: 16r80080014.
  223.      self at: #GTPA_NumColors         put: 16r80080046.
  224.      self at: #GTPA_ColorTable        put: 16r80080052.
  225.  
  226.      "Slider (proportional) Gadget Attributes:"
  227.      self at: #GTSL_Min               put: 16r80080026.
  228.      self at: #GTSL_Max               put: 16r80080027.
  229.      self at: #GTSL_Level             put: 16r80080028.
  230.      self at: #GTSL_MaxLevelLen       put: 16r80080029.
  231.      self at: #GTSL_LevelFormat       put: 16r8008002A.
  232.      self at: #GTSL_LevelPlace        put: 16r8008002B.
  233.      self at: #GTSL_DispFunc          put: 16r8008002C.
  234.      self at: #GTSL_MaxPixelLen       put: 16r80080050.
  235.      self at: #GTSL_Justification     put: 16r80080051.
  236.  
  237.      "Scroller Gadget Attributes:"
  238.      self at: #GTSC_Top               put: 16r80080015.
  239.      self at: #GTSC_Total             put: 16r80080016.
  240.      self at: #GTSC_Visible           put: 16r80080017.
  241.      self at: #GTSC_Overlap           put: 16r80080018.
  242.      self at: #GTSC_Arrows            put: 16r8008003B.
  243.  
  244.      "BevelBox Attribute(s):"
  245.      self at: #GTBB_Recessed          put: 16r80080033.
  246.      self at: #GTBB_FrameType         put: 16r8008004D.
  247. |
  248.    privateSetup
  249.      (uniqueInstance isNil)
  250.        ifTrue: [uniqueInstance <- self privateNew.
  251.                 self privateInitializeDictionary
  252.                ].
  253.  
  254.      ^ self "uniqueInstance??"
  255. ]
  256.  
  257.